#include "Loan.h"
using namespace std;

// @author A0088381W
Loan::Loan (string name, double amount, time_t timeOfRecord, string remark) : Entry ( name, amount) {
		_timeOfRecord = timeOfRecord;
		_remark = remark;
}

// @author A0088381W
Loan::Loan (string name, double amount, time_t timeOfRecord, time_t timeOfInput, string remark) : Entry ( name, amount, timeOfInput) {
	_timeOfRecord = timeOfRecord;
		_remark = remark;
}

//@author U095387X
Loan::Loan (string name, string objectString, string remark) {

	_name = name;
	_remark = remark;

	istringstream instr(objectString);
	instr >> _amount >> _timeOfRecord >> _timeOfInput;

}

// @author A0088381W
time_t Loan::getTimeOfRecord() {
	return _timeOfRecord;
}

// @author A0088381W
string Loan::getRemark() {
	return _remark;
}

//@author U095387X
string Loan::serialize(){
	ostringstream outstr;

	outstr << _name << endl;
	outstr << _amount << " " << _timeOfRecord << " " << _timeOfInput;

	return outstr.str();
}